{% extends "base.html" %}

{% block head %}
{{ super() }}
{% endblock head %}

{% block title %}
{{ word.word }}
{% endblock title %}

{% block content %}
{{ super() }}
<div class="container">
    <h1 class="word" style="margin-bottom: 0.5%;">{{ word.word }}</h1>
    <p>{{ word.meaning }}</p>
    {# usage是Option类型的，所以先做一个判断，看有没有这个值（None传进来应该是一个空字符串，判断为false） #}
    {% if word.usage %}
    <hr />
    <h2>用法</h2>
    <p>{{ word.usage }}</p>
    {% endif %}
    <hr />
    {% if related_words %}
    <div class="related-words">
        <h2>相关单词</h2>
        {% for word in related_words %}
        <a href="/word/{{ word.id }}">{{ word.word }}</a>
        {% endfor %}
        <hr />
    </div>
    {% endif %}
    <i class="date">{{ word.date }}</i>
</div>
{% endblock content %}